window.addEvent('domready', function() {
	/* Define the element which represents the output screen */
	var screen = $("output");

	/* Screen effects - before/after each Ajax request, do some screen effects */
	/* There is a spinner graphics, which is located on the underlying layer, below the screen. 
		When the screen fades, the spinner shows */
	var screenfx = new Fx.Style(screen, "opacity", {duration: 1000, wait: false});
	var curtainUp  = function(){
		screenfx.start(0,1);
	};
	var curtainDown = function(){
		screenfx.start(1,0);
	};
	
	/* shortened version of the Ajax call, because all calls will probably made with the same
		settings. First parameter is the file, relative to index.htm. Automacally does screen effects
		(curtainUp, curtainDown) */
	var ajax = function(file) {
		curtainDown();
		new Ajax(file, {
			method: 		'post', 
			update: 		screen,
			onComplete: 	curtainUp,
			evalScripts:	true
		}).request();
	}

	// End of Prelude
	
	
	/* AJAX/PHP test - Shows a table of player statistics */
	$("a_frags").addEvent('click', function() {
		ajax("php/frags.php");
	});

});